<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 基本数据类型存储在栈中
      let num = 10;
      let num2 = num;
      num2 = 20;
      console.log(num); //10
      console.log(num2); //20
      // 引用数据类型存储在堆中
      let obj = {
        name: "张三",
        age: 18,
      };
      let obj2 = obj; // 浅拷贝，把地址给到obj2
      obj2.name = "李四";
      console.log(obj.name); //李四
      console.log(obj2.name); //李四
    </script>
  </body>
</html>
